#region Imported Namespaces
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.WebControls;

using ProjectHeader = PHSRAG.Insight21.Agreements.ProjectHeader;
using Utility = PHSRAG.Utility;
using Policy = PHSRAG.Insight21.Policy;
using Constants = PHSRAG.Insight21.InsightUtilities.Constants;
#endregion

namespace PHSRAG.Insight21.InsightWebControls
{
    #region Class ProjectHeaderBar
    /// <summary>
    /// The ProjectHeaderBar is an Insight specific custom control that displays fund-specific information
    /// for use on a details page. The display format of the bar on the page is as follows:
    /// 
    /// Fund #	PI Name		Project Name	Sponsor Name	Sponsor #	Budget Start/End		Project Start/End        Inst    Chief
    /// ######	First Last	Project			Sponsor			#####		mm/dd/yyyy -- mm/dd/yyy	mm/dd/yyyy -- mm/dd/yyyy McLeans 55AA
    /// 
    /// Each page supplies the FundNumber by setting the FundNumber public property on the ProjectHeaderBar
    /// and all information loading, formatting and display will be handled by the control.
    /// 
    /// NB: This control is only for use on details pages that deal with a single fund.
    ///		It is not intended for use elsewhere.
    /// </summary>
    [ToolboxData("<{0}:ProjectHeaderBar runat=server />")]
    [Designer(typeof(ProjectHeaderBarDesigner), typeof(IDesigner))]
    public class ProjectHeaderBar : System.Web.UI.WebControls.WebControl, INamingContainer
    {
        #region Constants
        private const string RefreshDatesControlKey = "RefreshDates_D511306A-23E5-4d9b-AC38-17A2DEC0F6AE";
        #endregion

        #region Instance Variables
        private ProjectHeader projectHeaderLoader;
        private Label fundNumber;
        private Label status;
        private Label piName;
        private Label projectName;
        private Label sponsorName;
        private Label sponsorId;
        private Label budgetStart;
        private Label budgetEnd;
        private Label projectStart;
        private Label projectEnd;
        private Label institution;
        private Label chiefCode;
       

        private const int MaxFieldLength = 33;
        #endregion

        #region Instance Variables (Private)
        private Policy.ICachePolicy cachePolicy;
        #endregion

        #region Properties
        //		/// <summary>
        //		/// Set the current fund number (displayed in the information bar).
        //		/// This property must be set before the page is rendered for correct operation, otherwise
        //		/// the ProjectHeaderBar will not display any information.
        //		/// </summary>
        //		[Bindable(true), Category("Appearance"), Description("Current fund number")]
        //		public string FundNumber
        //		{
        ////			get { EnsureChildControls(); return fundNumber.Text; }
        //			set
        //			{ 
        //				DataSet ds = new DataSet();
        //
        //				projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
        //
        //				if (projectHeaderLoader == null || value != projectHeaderLoader.FundNumber)
        //				{
        //					projectHeaderLoader = new ProjectHeader(cachePolicy);
        //					projectHeaderLoader.Load(Utility.DataAccess.GetConnectionString(), value, DBNull.Value, DBNull.Value);
        //					projectHeaderLoader.Cache();
        //
        //					ds = projectHeaderLoader.GetDataContainer();
        //				}
        //				else
        //				{
        //					ds = projectHeaderLoader.GetDataContainer();
        //				}
        //
        //				EnsureChildControls();
        //
        //				fundNumber.Text = value;
        //				piName.Text = (string)(ds.Tables[0].Rows[0][1]);
        //				projectName.Text = (string)(ds.Tables[0].Rows[0][2]);
        //				sponsorName.Text = (string)(ds.Tables[0].Rows[0][3]);
        //				sponsorId.Text = (string)(ds.Tables[0].Rows[0][4]);
        //				budgetStart.Text = ((DateTime)(ds.Tables[0].Rows[0][5])).ToString("d");
        //				budgetEnd.Text = ((DateTime)(ds.Tables[0].Rows[0][6])).ToString("d");
        //				projectStart.Text = ((DateTime)(ds.Tables[0].Rows[0][7])).ToString("d");
        //				projectEnd.Text = ((DateTime)(ds.Tables[0].Rows[0][8])).ToString("d");
        //			}
        //		}

        /// <summary>
        /// Gets the current budget start date.
        /// </summary>
        public DateTime BudgetStartDate
        {
            get
            {
                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
                if (projectHeaderLoader == null)
                    throw new Exception("Please load the project header data container before calling Budget Start Date Property.");
                return (DateTime)projectHeaderLoader.GetDataContainer().Tables[0].Rows[0][5];
            }
        }

        /// <summary>
        /// Gets the current budget end date.
        /// </summary>
        public DateTime BudgetEndDate
        {
            get
            {
                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
                if (projectHeaderLoader == null)
                    throw new Exception("Please load the project header data container before calling Budget End Date Property.");
                return (DateTime)projectHeaderLoader.GetDataContainer().Tables[0].Rows[0][6];
            }
        }

        /// <summary>
        /// Gets the months remaining for the current budget year. Returns "0.00" if
        /// the current date is not within the current budget period for the project.
        /// </summary>
        public string MonthsRemainingInBudgetYear
        {
            get
            {
                DateTime budgetEndDate = BudgetEndDate.Date;
                DateTime budgetStartDate = BudgetStartDate.Date;
                DateTime glPostAsOfDate = GLPostAsOfDate;
                if (glPostAsOfDate < budgetEndDate && glPostAsOfDate > budgetStartDate)
                    return DateDifferenceInMonths(glPostAsOfDate, budgetEndDate);
                if (glPostAsOfDate < budgetStartDate)
                    return DateDifferenceInMonths(budgetStartDate, budgetEndDate);
                return "0.00";
            }
        }

        /// <summary>
        /// Gets the current project start date.
        /// </summary>
        public DateTime ProjectStartDate
        {
            get
            {
                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
                if (projectHeaderLoader == null)
                    throw new Exception("Please load the project header data container before calling Project Start Date Property.");
                return (DateTime)projectHeaderLoader.GetDataContainer().Tables[0].Rows[0][7];
            }
        }

        /// <summary>
        /// Gets the current project end date.
        /// </summary>
        public DateTime ProjectEndDate
        {
            get
            {
                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
                if (projectHeaderLoader == null)
                    throw new Exception("Please load the project header data container before calling Project End Date Property.");
                return (DateTime)projectHeaderLoader.GetDataContainer().Tables[0].Rows[0][8];
            }
        }


        /// <summary>
        /// Gets the months remaining in the project
        /// </summary>
        public string MonthsRemainingInProject
        {
            get
            {
                DateTime projectEndDate = ProjectEndDate.Date;
                DateTime projectStartDate = ProjectStartDate.Date;
                DateTime glPostAsOfDate = GLPostAsOfDate;
                if (glPostAsOfDate < projectEndDate && glPostAsOfDate > projectStartDate)
                    return DateDifferenceInMonths(glPostAsOfDate, projectEndDate);
                if (glPostAsOfDate < projectStartDate)
                    return DateDifferenceInMonths(projectStartDate, projectEndDate);
                return "0.00";
            }
        }

        /// <summary>
        /// Gets the date of the last GL post.
        /// </summary>
        public DateTime GLPostAsOfDate
        {
            get
            {
                DataSet ds = cachePolicy.GetCachedObject(RefreshDatesControlKey) as DataSet;
                if (ds == null)
                {
                    ds = Utility.DataAccess.GetDataSet(Utility.DataAccess.GetConnectionString(), "GetRefreshDates");
                    cachePolicy.Cache(RefreshDatesControlKey, ds);
                }
                return (DateTime)ds.Tables[0].Rows[0]["glPostAsOfDate"];
            }
        }
        /// <summary>
        /// Gets the institution code.
        /// </summary>
        public string Institution
        {
            get
            {
                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
                if (projectHeaderLoader == null)
                    throw new Exception("Please load the project header data container before calling Institution Property.");
                return (string)projectHeaderLoader.GetDataContainer().Tables[0].Rows[0][10];
            }
        }
        /// <summary>
        /// Gets the Chief code.
        /// </summary>
        public string ChiefCode
        {
            get
            {
                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
                if (projectHeaderLoader == null)
                    throw new Exception("Please load the project header data container before calling ChiefCode Property.");
                return (string)projectHeaderLoader.GetDataContainer().Tables[0].Rows[0][11];
            }
        }


        public string SponsorTypeId
        {
            get
            {
                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;
                if (projectHeaderLoader == null)
                    throw new Exception("Please load the project header data container before calling SponsorTypeId Property.");
                return (string)projectHeaderLoader.GetDataContainer().Tables[0].Rows[0][12].ToString();
            }
        }


        #endregion

        #region Public Static Methods
        /// <summary>
        /// This method will load the ProjectHeaderBar with whatever data is available for the given criteria.
        /// This method should be supplied with either:
        ///		a valid fundNumber and -1 for resourceId or
        ///		null for fundNumber and a valid resourceId.
        /// If both are provided, only the fundNumber will be used.
        /// </summary>
        /// <param name="fundNumber">The fundNumber of the project to be loaded.</param>
        /// <param name="resourceId">The resourceId of the unawarded project to be loaded.</param>
        public void LoadProjectHeader(string fundNumber, int resourceId)
        {
            LoadProjectHeader(fundNumber, resourceId, 0);
        }

        /// <summary>
        /// This method will load the ProjectHeaderBar with whatever data is available for the given criteria.
        /// This method should be supplied with either a valid fundNumber and -1 for resourceId or null for
        ///	fundNumber and a valid resourceId. If both are provided, only the fundNumber will be used.
        ///	It also takes a budgetYear in case a fund spans multiple years.
        /// </summary>
        /// <param name="fundNumber">The fundNumber of the project to be loaded.</param>
        /// <param name="resourceId">The resourceId of the unawarded project to be loaded.</param>
        /// <param name="budgetYear">The budget fiscal year of the project to be loaded.</param>
        public void LoadProjectHeader(string fundNumber, int resourceId, int budgetYear)
        {
            DataSet ds = new DataSet();

            projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;

            if (projectHeaderLoader == null ||
                fundNumber != projectHeaderLoader.FundNumber ||
                resourceId != projectHeaderLoader.ResourceId ||
                budgetYear != projectHeaderLoader.BudgetYear)
            {
                projectHeaderLoader = new ProjectHeader(cachePolicy);
                projectHeaderLoader.Load(Utility.DataAccess.GetConnectionString(), fundNumber, resourceId, budgetYear);
                projectHeaderLoader.Cache();

                ds = projectHeaderLoader.GetDataContainer();
            }
            else
            {
                ds = projectHeaderLoader.GetDataContainer();
            }

            EnsureChildControls();

            // For a given fund in a single budget year, there can't be more one project header! if there is, then we have a data problem.
            // Flag this via an exception.

            int count = ds.Tables[0].Rows.Count;
            if (count == 0)
                throw new Exception(Constants.ProjectHeaderException);
            if (count != 1)
                throw new Exception(string.Format("Found {0} Project Headers for Fund Number {1} in Budget Year {2}",
                    count, fundNumber, budgetYear));

            this.fundNumber.Text = (string)ds.Tables[0].Rows[0][0];
            piName.Text = (string)(ds.Tables[0].Rows[0][1]);

            string projName = (string)(ds.Tables[0].Rows[0][2]);
            if (projName.Length > MaxFieldLength)
            {
                projectName.Text = String.Format("{0}...", projName.Substring(0, MaxFieldLength));
                projectName.ToolTip = projName;
            }
            else
                projectName.Text = projName;

            string fullSponsorName = (string)(ds.Tables[0].Rows[0][3]);
            if (fullSponsorName.Length > MaxFieldLength)
            {
                sponsorName.Text = String.Format("{0}...", fullSponsorName.Substring(0, MaxFieldLength));
                sponsorName.ToolTip = fullSponsorName;
            }
            else
                sponsorName.Text = fullSponsorName;

            sponsorId.Text = (ds.Tables[0].Rows[0][4] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][4]);
            budgetStart.Text = (DateTime.Compare(((DateTime)(ds.Tables[0].Rows[0][5])), DateTime.Parse("1/1/1900")) == 0) ? "" : ((DateTime)(ds.Tables[0].Rows[0][5])).ToString("d");
            budgetEnd.Text = (DateTime.Compare(((DateTime)(ds.Tables[0].Rows[0][6])), DateTime.Parse("1/1/1900")) == 0) ? "" : ((DateTime)(ds.Tables[0].Rows[0][6])).ToString("d");
            projectStart.Text = (DateTime.Compare(((DateTime)(ds.Tables[0].Rows[0][7])), DateTime.Parse("1/1/1900")) == 0) ? "" : ((DateTime)(ds.Tables[0].Rows[0][7])).ToString("d");
            projectEnd.Text = (DateTime.Compare(((DateTime)(ds.Tables[0].Rows[0][8])), DateTime.Parse("1/1/1900")) == 0) ? "" : ((DateTime)(ds.Tables[0].Rows[0][8])).ToString("d");
            status.Text = (ds.Tables[0].Rows[0][9] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][9]);
            institution.Text = (ds.Tables[0].Rows[0][10] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][10]);
            chiefCode.Text = (ds.Tables[0].Rows[0][11] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][11]);
        }

        /// ----------------------------------------------------------------------------------------
        /// Modification 03-10-2008 jml29:
        /// This method is used from AgreementsBudgetOverview.aspx.cs.
        /// The Budget Periods on the Budget Detail Header need to match dates on the Budget Periods
        /// Drop Down List. TrackIt 7877.
        //------------------------------------------------------------------------------------------
        public void LoadProjectHeaderCumul(string fundNumber, int resourceId, int budgetYear, string budgetstr)
        {
            try
            {

                DataSet ds = new DataSet();
                string budstart = "";
                string budend = "";

                projectHeaderLoader = cachePolicy.GetCachedObject(ProjectHeader.CacheKey) as ProjectHeader;

                if (projectHeaderLoader == null ||
                    fundNumber != projectHeaderLoader.FundNumber ||
                    resourceId != projectHeaderLoader.ResourceId ||
                    budgetYear != projectHeaderLoader.BudgetYear)
                {
                    projectHeaderLoader = new ProjectHeader(cachePolicy);
                    projectHeaderLoader.Load(Utility.DataAccess.GetConnectionString(), fundNumber, resourceId, budgetYear);
                    projectHeaderLoader.Cache();

                    ds = projectHeaderLoader.GetDataContainer();
                }
                else
                {
                    ds = projectHeaderLoader.GetDataContainer();
                }

                EnsureChildControls();

                // For a given fund in a single budget year, there can't be more one project header! if there is, then we have a data problem.
                // Flag this via an exception.

                int count = ds.Tables[0].Rows.Count;
                if (count == 0)
                    throw new Exception(Constants.ProjectHeaderException);
                if (count != 1)
                    throw new Exception(string.Format("Found {0} Project Headers for Fund Number {1} in Budget Year {2}",
                        count, fundNumber, budgetYear));

                this.fundNumber.Text = (string)ds.Tables[0].Rows[0][0];
                piName.Text = (string)(ds.Tables[0].Rows[0][1]);

                string projName = (string)(ds.Tables[0].Rows[0][2]);
                if (projName.Length > MaxFieldLength)
                {
                    projectName.Text = String.Format("{0}...", projName.Substring(0, MaxFieldLength));
                    projectName.ToolTip = projName;
                }
                else
                    projectName.Text = projName;

                string fullSponsorName = (string)(ds.Tables[0].Rows[0][3]);
                if (fullSponsorName.Length > MaxFieldLength)
                {
                    sponsorName.Text = String.Format("{0}...", fullSponsorName.Substring(0, MaxFieldLength));
                    sponsorName.ToolTip = fullSponsorName;
                }
                else
                    sponsorName.Text = fullSponsorName;

                //The below block is to determine correct Budget Year Start Date and Budget Year End Date.
                //After modifications for Cumulative Flag Calculations, the Budget Periods are determined by stored procedure
                //GetBudgetYears. The Budget Periods on the Budget Detail Header need to match dates on the Budget Periods
                //Drop Down List. TrackIt 7877 jml29 03-07-2008.
                //-----------------------------------------------------------------------------------------------------------
                budstart = budgetstr.Split('|')[0];
                budend = budgetstr.Split('|')[1];
                sponsorId.Text = (ds.Tables[0].Rows[0][4] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][4]);
                budgetStart.Text = budstart;
                budgetEnd.Text = budend;
                projectStart.Text = (DateTime.Compare(((DateTime)(ds.Tables[0].Rows[0][7])), DateTime.Parse("1/1/1900")) == 0) ? "" : ((DateTime)(ds.Tables[0].Rows[0][7])).ToString("d");
                projectEnd.Text = (DateTime.Compare(((DateTime)(ds.Tables[0].Rows[0][8])), DateTime.Parse("1/1/1900")) == 0) ? "" : ((DateTime)(ds.Tables[0].Rows[0][8])).ToString("d");
                status.Text = (ds.Tables[0].Rows[0][9] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][9]);
                institution.Text = (ds.Tables[0].Rows[0][10] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][10]);
                chiefCode.Text = (ds.Tables[0].Rows[0][11] == DBNull.Value) ? string.Empty : (string)(ds.Tables[0].Rows[0][11]);                
            }
            catch (Exception ex)
            {
                throw new Exception("Error from LoadProjectHeaderCumul of ProjectHeaderBar.cs: " + ex.Message);
            }
        }

        #endregion

        #region Overrides
        /// <summary>
        /// Create all controls that will be on the ProjectHeaderBar. Notice that the creation is more than just instantiating
        /// the controls. It also involves in generating the underlying HTML so that the controls shows up per the need.
        /// </summary>
        protected override void CreateChildControls()
        {
            CreateControls();
            GenerateControlTree();
        }

        /// <summary>
        /// Handler for the event raised when the control is being initialized.
        /// Retrieve the cache policy in force.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            cachePolicy = (Policy.ICachePolicy)Page.Session[Policy.Names.CachePolicyKey];
        }

        #endregion

        #region Private Methods
        /// <summary>
        /// Create all controls in the ProjectHeaderBar.
        /// </summary>
        private void CreateControls()
        {
            fundNumber = new Label();
            status = new Label();
            piName = new Label();
            projectName = new Label();
            sponsorName = new Label();
            sponsorId = new Label();
            budgetStart = new Label();
            budgetEnd = new Label();
            projectStart = new Label();
            projectEnd = new Label();
            institution = new Label();
            chiefCode = new Label();
          
        }

        /// <summary>
        /// Setup the control tree to reflect the actual (and exact) layout of the controls within the ProjectHeaderBar.
        /// </summary>
        private void GenerateControlTree()
        {
            Table outerTable = new Table();
            Controls.Add(outerTable);
            outerTable.BackColor = System.Drawing.Color.White;
            outerTable.CellSpacing = 10;
            outerTable.CellPadding = 0;
            outerTable.Width = Unit.Percentage(100);

            TableRow row = new TableRow();
            outerTable.Rows.Add(row);

            TableCell cell = new TableCell();
            cell.HorizontalAlign = HorizontalAlign.Left;
            row.Cells.Add(cell);

            Table table = new Table();
            cell.Controls.Add(table);
            table.CssClass = "ProjectHeaderBar";
            table.CellSpacing = 5;

            row = new TableRow();
            table.Rows.Add(row);
            row.CssClass = "ProjectHeaderBarCategories";

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Fund #</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("Status"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>PI Name</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Project Title</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Sponsor Name</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Sponsor #</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Budget Start/End</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Project Start/End</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Institution</nobr>"));

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(new LiteralControl("<nobr>Chief Code</nobr>"));

            row = new TableRow();
            table.Rows.Add(row);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(fundNumber);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(status);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(piName);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(projectName);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(sponsorName);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(sponsorId);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(budgetStart);
            cell.Controls.Add(new LiteralControl("&nbsp;--&nbsp;"));
            cell.Controls.Add(budgetEnd);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(projectStart);
            cell.Controls.Add(new LiteralControl("&nbsp;--&nbsp;"));
            cell.Controls.Add(projectEnd);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(institution);

            cell = new TableCell();
            row.Cells.Add(cell);
            cell.Controls.Add(chiefCode);
        }

        /// <summary>
        /// Gives a date difference, in months, between two dates.
        /// </summary>
        /// <param name="startDate">start date.</param>
        /// <param name="endDate">end date.</param>
        /// <returns>a string representation of date difference in months</returns>
        private static string DateDifferenceInMonths(DateTime startDate, DateTime endDate)
        {
            return Convert.ToString(Math.Round((new TimeSpan(endDate.Ticks - startDate.Ticks).TotalDays * 12 / 365), 2));
        }

        #endregion

        #region Internal Methods
        /// <summary>
        /// This method is ONLY invoked by the associated designer to show the control contents at design time.
        /// </summary>
        internal void Design()
        {
            EnsureChildControls();
        }
        #endregion
    }
    #endregion

    #region Class ProjectHeaderBarDesigner
    /// <summary>
    /// Designer associated with the control.
    /// </summary>
    public class ProjectHeaderBarDesigner : ControlDesigner
    {
        #region Overrides
        /// <summary>
        /// Force the control to create its child controls for display at design time.
        /// </summary>
        /// <returns>HTML representation of the control</returns>
        public override string GetDesignTimeHtml()
        {
            ((ProjectHeaderBar)Component).Design();
            return base.GetDesignTimeHtml();
        }
        #endregion
    }
    #endregion
}
